<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/2/24
 * Time: 10:12
 */

namespace app\weixin\controller;

//用户举报
class PointsLog extends Base
{
    public function _initialize()
    {
        parent::_initialize();
    }

    //金币变更日志列表
    public function index(){
        $map = [];
        $start = input("start");//搜索条件
        $end = input("end");
        $display_name = input("display_name");
        if(!empty($start) && empty($end)){
            $map["create_time"] = array("egt",strtotime($start));
        }else if(!empty($end) && empty($start) ){
            $map["create_time"] = array("elt",strtotime($end));
        }else if(!empty($start) && !empty($end)){
            $map["create_time"][] = array("egt",strtotime($start));
            $map["create_time"][] = array("elt",strtotime($end));
        }
        if(!empty($display_name)){
            $map["user_name"] = [
                'like',
                "%$display_name%" 
            ];
        }
        $pagesize = config('paginate')['list_rows'];//每页数量
        $param=request()->param(); //获取url参数
        $lists = db('points_log')->where($map)->order('id desc')->paginate($pagesize,false,array('query' => array_splice($param,1)));
        $this->assign("lists",$lists);
        $this->assign("page", $lists->render());

        return $this->fetch();
    }
}